﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NationalD3.Application.AutoMapper;
using Microsoft.Extensions.DependencyInjection;

namespace NationalD3.ApiServer.Extentions
{
    /// <summary>
    /// AutoMapper配置类
    /// </summary>
    public static class AutoMapperSetup
    {
        //扩展方法
        public static void AddAutoMapperSetup(this IServiceCollection services)
        {
            if (services == null) 
                throw new ArgumentNullException(nameof(services));

            //添加服务
            services.AddAutoMapper(typeof(AutoMapperConfig));

            //启动配置
            AutoMapperConfig.RegisterMappings();
        }
    }
}
